cmake_minimum_required(VERSION 3.10)
# set the project name
project(GeoTiffReader)

# find required opencv
find_package(OpenCV REQUIRED)
message('OpenCV LIBS:${OpenCV_LIBS}')
message('OpenCV LIB DIRS:${OpenCV_LIBRARY_DIRS}')

# directory of opencv headers
include_directories(${OpenCV_INCLUDE_DIRS})

message('Include path:${CMAKE_INSTALL_PREFIX}/include')
include_directories(${CMAKE_INSTALL_PREFIX}/include)

include_directories(${CMAKE_INSTALL_PREFIX})

# name of executable file and path of source file
add_executable(Test Test.cxx GeoTiffReader.cxx GeoTiffImage.cxx)

# directory of opencv library
link_directories(${OpenCV_LIBRARY_DIRS})
link_directories(/usr/local/lib)

# opencv libraries
target_link_libraries(Test ${OpenCV_LIBS})
target_link_libraries(Test tiff)


add_executable(Split Split.cxx GeoTiffReader.cxx GeoTiffImage.cxx)
target_link_libraries(Split ${OpenCV_LIBS})
target_link_libraries(Split tiff)

add_executable(Merge Merge.cxx GeoTiffMerger.cxx GeoTiffImage.cxx FileUtils.cxx GeoTiffReader.cxx GeoTiffWriter.cxx)
target_link_libraries(Merge ${OpenCV_LIBS})
target_link_libraries(Merge tiff tiffxx geotiff)

add_executable(NIMerge NIMerge.cxx NormalImageMerger.cxx ImageMerger.cxx FileUtils.cxx)
target_link_libraries(NIMerge ${OpenCV_LIBS})

add_executable(IPNGMerge IPNGMerge.cxx IPNGUtils.cxx IPNGImageMerger.cxx ImageMerger.cxx FileUtils.cxx)
target_link_libraries(IPNGMerge ${OpenCV_LIBS} z)

add_executable(IPNGTest IPNGTest.cxx IPNGUtils.cxx)
target_link_libraries(IPNGTest ${OpenCV_LIBS} z)

add_executable(GeoTiffImageTest GeoTiffImageTest.cxx GeoTiffImage.cxx GeoTiffWriter.cxx GeoTiffReader.cxx)
target_link_libraries(GeoTiffImageTest tiff tiffxx geotiff ${OpenCV_LIBS})

add_executable(AreaSurvey AreaSurvey.cxx AreaIntegrator.cxx IPNGUtils.cxx GeoTiffImage.cxx GeoTiffReader.cxx)
target_link_libraries(AreaSurvey tiff tiffxx geotiff ${OpenCV_LIBS} z)